package com.example.templateapp.util.http

import android.app.ActivityManager
import android.content.Context

object ServiceUtil {

    fun isRunService(
        context: Context,
        serviceName: String
    ): Boolean {
        val manager =
            context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
        for (service in manager.getRunningServices(Int.MAX_VALUE)) {
            if (serviceName == service.service.className) {
                return true
            }
        }
        return false
    }
}